<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>Document</title>
</head>
<body>
	<input type="button" id="btn" value="点击">
	<script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>
	<script type="text/javascript">
	$(function  () {
		$('#btn').click(function(event) {
			name = "zhibinm";
			$.ajax({
				url: './check.php',
				type: 'post',
				dataType: 'json',
				data: {username: name},
			})
			.done(function(data) {
				alert(data.usernam);
			})
			.fail(function() {
				alert(777)
				
			})
		});
	})
	</script>
</body>
</html>